﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Entity;
using System.Data;
using DbCommon;

namespace Web.admin.tool
{
    /// <summary>
    /// CheckGroup 的摘要说明
    /// </summary>
    public class CheckGroup : IHttpHandler
    {

        public void ProcessRequest(HttpContext context)
        {
            //不让浏览器设有缓存
            context.Response.Buffer = true;
            context.Response.ExpiresAbsolute = DateTime.Now.AddDays(-1);
            context.Response.AddHeader("pragma", "no-cache");
            context.Response.AddHeader("cache-control", "");
            context.Response.CacheControl = "no-cache";
            context.Response.ContentType = "text/plain";
            string GroupName = context.Request["GroupName"];
            string ConId = context.Request["ConId"];
            BLL.GroupsService groupservice= new BLL.GroupsService();
            DataTable particpantsTable = groupservice.Getv_participantStuAndGroup(ConId,GroupName);
            if (particpantsTable.Rows.Count > 0)
            {
                string jsonData = JsonHelper.DataTableToJSON(particpantsTable, "tempTable");
                context.Response.Write(jsonData);
            }
            else
            {
                context.Response.Write("该竞赛不存在此小组");
            }
            //DataTable particpantsTable = particpantservice.GetParicipantAndStudentByCode(stuid.ToString(), ConId);
            //if (particpantsTable.Rows.Count > 0)
            //{
            //    string jsonData = JsonHelper.DataTableToJSON(particpantsTable, "tempTable");
            //    context.Response.Write(jsonData);
            //}
            //else
            //    context.Response.Write("该学生没有参加该竞赛");
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}